<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,user-scalable=no,minimal-ui">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../img/asset-favico.ico">
    <title>预约</title>
    <link rel="stylesheet" href="../css/page-health-order.css"/>
</head>
<body data-spy="scroll" data-target="#myNavbar" data-offset="150">
<div class="app" id="app">
    <!-- 页面头部 -->
    <div class="top-header">
        <span class="f-left"><i class="icon-back" onclick="history.go(-1)"></i></span>
        <span class="center">传智健康</span>
        <span class="f-right"><i class="icon-more"></i></span>
    </div>
    <!-- 页面内容 -->
    <div class="contentBox">
        <div class="list-column1">
            <ul class="list">


                <li class="list-item" v-for="setmeal in setmealList">

                    <a class="link-page" :href="'setmeal_detail.html?id='+setmeal.id">
                        <!--动态显示存储在七牛云中的图片 'http://qjhg2j8pb.hd-bkt.clouddn.com/'+setmeal.img 图片的完整路径-->
                        <img class="img-object f-left" :src="'http://qjhg2j8pb.hd-bkt.clouddn.com/'+setmeal.img" alt="">
                        <div class="item-body">
                            <h4 class="ellipsis item-title">{{setmeal.name}}</h4>
                            <p class="ellipsis-more item-desc">{{setmeal.remark}}</p>
                            <p class="item-keywords">
                                <span>{{setmeal.sex == '0' ? '性别不限' : setmeal.sex == '1' ? '男':'女'}}</span></br>
                                <span>{{setmeal.age}}</span>
                            </p>
                        </div>
                    </a>
                </li>

            </ul>
        </div>
        <div class="loading" style="text-align: center; height:100px">
            <img src="../img/loading2.gif" height="100%">
        </div>
    </div>


</div>
<!-- 页面 css js -->
<script src="../plugins/vue/vue.js"></script>
<script src="../plugins/vue/axios-0.18.0.js"></script>
<script src="../plugins/jquery-3.3.1.min.js"></script>
<!--<script src="../js/page-health-order.js"></script>-->
<script>
    var vue = new Vue({
        el: '#app',
        data: {
            setmealList: [],
        },
        //钩子函数， VUE加载完成后进行 调用(可以看成页面加载完成时进行调用)
        mounted() {
            this.pageInfo()
        },
        methods: {
            pageInfo() {
                axios.get("/setmeal/getPageSetmeal.do?start=" + 1 + "&pageSize=" + 5).then((response) => {
                    this.setmealList = response.data.rows;
                    start++;
                });
            }
        }
    });
    let start = 2;
    let pageSize = 2;
    let flag = true;
    let bottom = 10;
    $(".loading").hide();

    $(function () {
        $(window).scroll(function () {
            //当前窗口的高度
            let windowHeight = $(window).height();
            //滚动条从上到下滚动距离
            let scrollTop = $(window).scrollTop();
            //当前文档的高度
            let docHeight = $(document).height();
            if (windowHeight + scrollTop + bottom >= docHeight) {
                if (flag == true) {
                    flag = false;
                    $.get(
                        "/setmeal/getPageSetmeal.do?start=" + start + "&pageSize=" + pageSize, function (data) {
                            if (data.length == 0) {
                                $(".loading").hide();
                                $("#no").html("我也是有底线的");
                            } else {
                                $(".loading").show();
                                let titles = "";
                                for (let i = 0; i < data.length; i++) {
                                    titles += ("<li>\n" +
                                        "                <div class=\"title-box\">\n" +
                                        "                    <a href=\"#\" class=\"link\">\n" +
                                        data[i].title +
                                        "                        <hr>\n" +
                                        "                    </a>\n" +
                                        "                </div>\n" +
                                        "            </li>");
                                }
                                $(".loading").hide();
                                $(".list").append(titles);
                                start++;
                                flag = true;
                            }
                        }, "json");
                }
            }
        });
    });


</script>
</body>